// 2013-9-12上午02:21:04  net.betou.trade.main.dao.agency.Dao.java

package net.betou.trade.main.dao.agencyorproxy;

import net.betou.common.hibernate3.Updater;
import net.betou.common.page.Pagination;
import net.betou.trade.entity.main.AgentAndAdmins;

/**
 * 
 * @author 叶装装
 */
public interface Dao{

	/**
	 * 根据用户名统计
	 * @param username
	 * @return
	 */
	public int countByUsername( String username );

	/**
	 * 根据email统计
	 * @param email
	 * @return
	 */
	public int countByEmail( String email );

	/**
	 * 根据手机号码统计
	 * @param mobile
	 * @return
	 */
	public int countByMobile( String mobile );

	/**
	 * 根据机构名称统计
	 * @param name
	 * @return
	 */
	public int countByName( String name );

	/**
	 * 根据用户名查找
	 * @param username
	 * @return
	 */
	public AgentAndAdmins findByUsername( String username );
	
	public AgentAndAdmins findByIntermediaName( String intermediaName );
	
	/**
	 * 查找ID
	 * @param id
	 * @return
	 */
	public AgentAndAdmins findById( Integer id );
	
	/**
	 * 获取分页数据
	 * @param system
	 * @param justAdmin
	 * @param agencyOrProxy
	 * @param selfId
	 * @param searchProperty
	 * @param searchValue
	 * @param orderProperty
	 * @param orderDirection
	 * @param pageNo
	 * @param pageSize
	 * @param filterStatus
	 * @return
	 */
	public Pagination getPage( Boolean system, Boolean justAdmin, Boolean agencyOrProxy, Integer selfId, String searchProperty, String searchValue, String orderProperty, String orderDirection, int pageNo, int pageSize, String filterStatus );
	
	/**
	 * 保存
	 * @param bean
	 * @return
	 */
	public AgentAndAdmins save( AgentAndAdmins bean );

	/**
	 * 根据ID删除
	 * @param id
	 * @return
	 */
	public AgentAndAdmins deleteById( Integer id );

	/**
	 * 更新
	 * @param updater
	 * @return
	 */
	public AgentAndAdmins updateByUpdater( Updater< AgentAndAdmins > updater );
	
	public Pagination getPageByCriteria( String searchProperty, String searchValue, String orderProperty, String orderDirection, int pageNo, int pageSize, String sql );
}
